import $api from '../../api'


export default{
    namespaced:true,
    state:{
        admins:[]
    },
    actions:{
        async asyncAdmins(context,payload){
            const res = await $api.users.getAdmins()
            console.log(res.data);
            context.state.admins=res.data.message
          
        },
        async asyncDelAdmins(context,payload){
            const res =await $api.users.delAdmins(payload)
            if(res.data.code){
                context.dispatch('asyncAdmins')
            }

        },
        async asyncAddAdmin(context,payload){
           const res = await $api.users.addAdmin(payload)
           console.log(res);
        }
    }
}